#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
   /*打开文件*/
   const char *filename = "./record.txt";
   int fd = open(filename, O_RDWR | O_CREAT,0644);
   if(fd == -1)
   {
      perror("open error");
      exit(-1);
   }
    printf("fd = %d\n",fd);
    const char *buffer = "hello world!";
    int wirteBytes = write(fd,(void*)buffer,strlen(buffer));
    printf("wirteBytes = %d\n",wirteBytes);
    close(fd);
    return 0;
}